package com.wlw.service;

import java.util.List;

import javax.servlet.http.HttpServletRequest;

import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import com.wlw.entity.Scenery;

import edu.xjsoft.base.service.DefaultEntityManager;

@Service
@Transactional
public class SceneryService extends DefaultEntityManager<Scenery> {
	
	//国内热门推荐：（国内景点点赞数排序）
	public List<Scenery> homeHotScenery() {
		String hql = "select s from Scenery s where s.city.foreign.country=? order by zanCount desc";
		List<Scenery> homeSceneries = getEntityDao().find(hql,"中国");
		return homeSceneries;
	}
	//国内热门推荐：（境外景点点赞数排序）
	public List<Scenery> foreignHotScenery() {
		String hql = "select s from Scenery s where s.city.foreign.country!=? order by zanCount desc";
		List<Scenery> foreignSceneries = getEntityDao().find(hql,"中国");
		return foreignSceneries;
	}
	//搜索景点（模糊搜索）
	public List<Scenery> searchScenery(String name){
		String hql = "select s from Scenery s where s.name like ?";
		List<Scenery> sceneries = getEntityDao().find(hql, "%"+name+"%");
		return sceneries;
	}
	//当地景点：
	public List<Scenery> localSceneries(String name){
		String hql = "select s from Scenery s where s.city.name = ?";
		List<Scenery> sceneries = getEntityDao().find(hql, name);
		return sceneries;
	}
}
